<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSelect="handleSelect"/>

    <el-row style="background:#fff;padding:10px 10px 0;margin-bottom:32px;">
      <bar-chart/>
    </el-row>

    <el-row :gutter="32">
      <el-col :lg="8" :sm="24" :xs="24">
        <div class="chart-wrapper">
          <pie-simple-chart/>
        </div>
      </el-col>
      <el-col :lg="8" :sm="24" :xs="24">
        <div class="chart-wrapper">
          <pie-chart/>
        </div>
      </el-col>
      <el-col :lg="8" :sm="24" :xs="24">
        <div class="chart-wrapper">
          <calendar-chart/>
        </div>
      </el-col>
    </el-row>


  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import CalendarChart from './dashboard/CalendarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import PieSimpleChart from './dashboard/PieSimpleChart'

export default {
  name: 'Index',
  components: {
    PanelGroup,
    CalendarChart,
    PieSimpleChart,
    PieChart,
    BarChart
  },
  data() {
    return {}
  },
  methods: {
    handleSelect(type) {
      switch (type) {
        case 'todo': // 待办事项
          this.$router.push('/workbench/Task')
          break
        case 'warn': // 预警
          this.$router.push('/sample/SampleAlarm')
          break
        case 'sample': // 样本总数
          this.$router.push('/sample/SampleList')
          break
        case 'source': // 样本源总数
          this.$router.push('/source/SourceList')
          break
        default:
          break
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 10px 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 24px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
